Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Q is empty.


QTRS
  ↳ Overlay + Local Confluence

Q restricted rewrite system:
The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Q is empty.

The TRS is overlay and locally confluent. By [19] we can switch to innermost.

↳ QTRS
  ↳ Overlay + Local Confluence
QTRS
      ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))


Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

BSORT(.(x, y)) → BUBBLE(.(x, y))
BSORT(.(x, y)) → BUTLAST(bubble(.(x, y)))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(x, z))
BSORT(.(x, y)) → BSORT(butlast(bubble(.(x, y))))
BSORT(.(x, y)) → LAST(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
BUTLAST(.(x, .(y, z))) → BUTLAST(.(y, z))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(y, z))
LAST(.(x, .(y, z))) → LAST(.(y, z))

The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
QDP
          ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

BSORT(.(x, y)) → BUBBLE(.(x, y))
BSORT(.(x, y)) → BUTLAST(bubble(.(x, y)))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(x, z))
BSORT(.(x, y)) → BSORT(butlast(bubble(.(x, y))))
BSORT(.(x, y)) → LAST(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
BUTLAST(.(x, .(y, z))) → BUTLAST(.(y, z))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(y, z))
LAST(.(x, .(y, z))) → LAST(.(y, z))

The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 4 SCCs with 3 less nodes.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
QDP
                ↳ UsableRulesProof
              ↳ QDP
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

BUTLAST(.(x, .(y, z))) → BUTLAST(.(y, z))

The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof
              ↳ QDP
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

BUTLAST(.(x, .(y, z))) → BUTLAST(.(y, z))

R is empty.
The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ QDP
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

BUTLAST(.(x, .(y, z))) → BUTLAST(.(y, z))

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
QDP
                ↳ UsableRulesProof
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

LAST(.(x, .(y, z))) → LAST(.(y, z))

The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

LAST(.(x, .(y, z))) → LAST(.(y, z))

R is empty.
The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

LAST(.(x, .(y, z))) → LAST(.(y, z))

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
QDP
                ↳ UsableRulesProof
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

BUBBLE(.(x, .(y, z))) → BUBBLE(.(x, z))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(y, z))

The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

BUBBLE(.(x, .(y, z))) → BUBBLE(.(x, z))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(y, z))

R is empty.
The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ RuleRemovalProof
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

BUBBLE(.(x, .(y, z))) → BUBBLE(.(x, z))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(y, z))

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

BUBBLE(.(x, .(y, z))) → BUBBLE(.(x, z))
BUBBLE(.(x, .(y, z))) → BUBBLE(.(y, z))


Used ordering: POLO with Polynomial interpretation [25]:

POL(.(x1, x2)) = 1 + 2·x1 + 2·x2   
POL(BUBBLE(x1)) = 2·x1   



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
                      ↳ QDP
                        ↳ RuleRemovalProof
QDP
                            ↳ PisEmptyProof
              ↳ QDP

Q DP problem:
P is empty.
R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
QDP
                ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

BSORT(.(x, y)) → BSORT(butlast(bubble(.(x, y))))

The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof

Q DP problem:
The TRS P consists of the following rules:

BSORT(.(x, y)) → BSORT(butlast(bubble(.(x, y))))

The TRS R consists of the following rules:

bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bsort(nil)
bsort(.(x0, x1))
bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

bsort(nil)
bsort(.(x0, x1))
last(nil)
last(.(x0, nil))
last(.(x0, .(x1, x2)))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

BSORT(.(x, y)) → BSORT(butlast(bubble(.(x, y))))

The TRS R consists of the following rules:

bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule BSORT(.(x, y)) → BSORT(butlast(bubble(.(x, y)))) at position [0] we obtained the following new rules:

BSORT(.(x0, .(x1, x2))) → BSORT(butlast(if(<=(x0, x1), .(x1, bubble(.(x0, x2))), .(x0, bubble(.(x1, x2))))))
BSORT(.(x0, nil)) → BSORT(butlast(.(x0, nil)))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
                      ↳ QDP
                        ↳ Narrowing
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

BSORT(.(x0, nil)) → BSORT(butlast(.(x0, nil)))
BSORT(.(x0, .(x1, x2))) → BSORT(butlast(if(<=(x0, x1), .(x1, bubble(.(x0, x2))), .(x0, bubble(.(x1, x2))))))

The TRS R consists of the following rules:

bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

The set Q consists of the following terms:

bubble(nil)
bubble(.(x0, nil))
bubble(.(x0, .(x1, x2)))
butlast(nil)
butlast(.(x0, nil))
butlast(.(x0, .(x1, x2)))

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 2 less nodes.